package controller

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"root/consts"
)

type Response struct {
	Code int `json:"code"`
	Message string `json:"message"`
	Data interface{} `json:"data"`
}


func SendResponse(c *gin.Context, code int, message string, data interface{}) {

	if message == "" {
		message = consts.GetMsg(code)
	}
	//if(len(data) == 0){
	//	var emptyData empty
	//	data = emptyData
	//}

	c.JSON(http.StatusOK, Response{
		Code: code,
		Message:message ,
		Data: data,
	})
}